- 
                Notifications
    You must be signed in to change notification settings 
- Fork 31
          kn: implement SystemDefaultProvider for Native
          #1231
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
        
          
                runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/util/SystemPlatformProviderTest.kt
          
            Show resolved
            Hide resolved
        
              
          
                runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/util/SystemPlatformProviderTest.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/util/SystemPlatformProviderTest.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | @Test | ||
| fun testOsInfo() = runTest { | ||
| val osInfo = PlatformProvider.System.osInfo() | ||
| assertNotEquals(OsFamily.Unknown, osInfo.family) | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Do we have tests anywhere to verify that the correct OS family is returned as opposed to verifying the incorrect one isn't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we don't. Since this is a common test it's not possible to assert on a specific OS family. I'll try making a target-specific source set (i.e. linuxx64) and add a test there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a LinuxX64 test
        
          
                runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/util/PlatformNative.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/util/PlatformNative.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/util/PlatformNative.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | actual override suspend fun readFileOrNull(path: String): ByteArray? { | ||
| TODO("Not yet implemented") | ||
| return try { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: The JVM impl dispatches to IO. Should this impl do the same? (similar question for writeFile)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, I think it should
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
    
      
        1 similar comment
      
    
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| } | ||
|  | ||
| @Test | ||
| fun definitelyShouldFail() = runTest { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this wasn't meant to be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it here to make sure the Linux tests are running in CI. Will be removed
|  | ||
| val family = when { | ||
| sysName.contains("darwin") -> { | ||
| if (machine.startsWith("iPhone") || machine.startsWith("iPad")) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Can we cover Apple watches & TV's as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I added them along with a TODO to validate it actually gets resolved correctly
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| Affected ArtifactsChanged in size
 | 
SystemDefaultProviderfor NativePlatformIssue #
Description of changes
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
… to
Filesysteminterface